#pragma once

/*************************
*          MAIN          *
*************************/

union custom_reg {
	unsigned char bytes[8];
	signed   char s8;
	unsigned char u8;
	signed   short s16;
	unsigned short u16;
	signed   int s32;
	unsigned int u32;
	signed   long long int s64;
	unsigned long long int u64;
};

struct instance {
	union custom_reg  regs[3];
	union custom_reg* outReg;
	unsigned int outRegNo;
	
	long long int cpuFlags;
	
	const struct host_asm_ops* ops;
};

struct host_asm_ops {
	
	int regSize;
	
	//math
	void( *add  ) ( struct instance* );
	void( *sub  ) ( struct instance* );
	void( *mul  ) ( struct instance* );
	void( *imul ) ( struct instance* );
	void( *div  ) ( struct instance* );
	void( *idiv ) ( struct instance* );
	void( *neg  ) ( struct instance* );
	
	//logic
	void( *and ) ( struct instance* );
	void( *not ) ( struct instance* );
	void( *or  ) ( struct instance* );
	void( *xor ) ( struct instance* );
	
	//shift
	void( *shl ) ( struct instance* );
	void( *shr ) ( struct instance* );
	void( *sal ) ( struct instance* );
	void( *sar ) ( struct instance* );
	void( *rol ) ( struct instance* );
	void( *ror ) ( struct instance* );
	
	//other
	void( *bswap ) ( struct instance* );
	void( *movsx ) ( struct instance* );
	
};


int setHostAsmOps( struct instance* this, int regSize );
